home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / ADSPSecure.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  6.0 KB  |  188 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ADSPSecure.h
  3.  
  4.      Contains:    Secure AppleTalk Data Stream Protocol Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ADSPSECURE__
  18. #define __ADSPSECURE__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __ADSP__
  24. #include <ADSP.h>
  25. #endif
  26. #ifndef __OCEAUTHDIR__
  27. #include <OCEAuthDir.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52. /* New ADSP control codes
  53.  
  54.  * open a secure connection */
  55.  
  56. enum {
  57.     sdspOpen                    = 229
  58. };
  59.  
  60. /*
  61. For secure connections, the eom field of ioParams contains two single-bit flags
  62. (instead of a zero/non-zero byte). They are an encrypt flag (see below), and an
  63. eom flag.  All other bits in that field should be zero.
  64.  
  65. To write an encrypted message, you must set an encrypt bit in the eom field of
  66. the ioParams of your write call. Note: this flag is only checked on the first
  67. write of a message (the first write on a connection, or the first write following
  68. a write with eom set.
  69. */
  70.  
  71. enum {
  72.     dspEOMBit                    = 0,                            /* set if EOM at end of write */
  73.     dspEncryptBit                = 1                                /* set to encrypt message */
  74. };
  75.  
  76.  
  77. enum {
  78.     dspEOMMask                    = 1 << dspEOMBit,
  79.     dspEncryptMask                = 1 << dspEncryptBit
  80. };
  81.  
  82.  
  83. /*
  84. Define an ADSPSecure parameter block, as used for the secure Open call.
  85.  
  86.  * size of ADSPSecure workspace */
  87.  
  88. enum {
  89.     sdspWorkSize                = 2048
  90. };
  91.  
  92.  
  93. struct TRSecureParams {
  94.     unsigned short                     localCID;                    /* local connection id */
  95.     unsigned short                     remoteCID;                    /* remote connection id */
  96.     AddrBlock                         remoteAddress;                /* address of remote end */
  97.     AddrBlock                         filterAddress;                /* address filter */
  98.     unsigned long                     sendSeq;                    /* local send sequence number */
  99.     unsigned short                     sendWindow;                    /* send window size */
  100.     unsigned long                     recvSeq;                    /* receive sequence number */
  101.     unsigned long                     attnSendSeq;                /* attention send sequence number */
  102.     unsigned long                     attnRecvSeq;                /* attention receive sequence number */
  103.     unsigned char                     ocMode;                        /* open connection mode */
  104.     unsigned char                     ocInterval;                    /* open connection request retry interval */
  105.     unsigned char                     ocMaximum;                    /* open connection request retry maximum */
  106.  
  107.     Boolean                         secure;                        /*  --> TRUE if session was authenticated */
  108.     AuthKeyPtr                         sessionKey;                    /* <--> encryption key for session */
  109.     unsigned long                     credentialsSize;            /*  --> length of credentials */
  110.     void *                            credentials;                /*  --> pointer to credentials */
  111.     void *                            workspace;                    /*  --> pointer to workspace for connection align on even boundary and length = sdspWorkSize */
  112.     AuthIdentity                     recipient;                    /*  --> identity of recipient (or initiator if active mode */
  113.     UTCTime                         issueTime;                    /*  --> when credentials were issued */
  114.     UTCTime                         expiry;                        /*  --> when credentials expiry */
  115.     RecordIDPtr                     initiator;                    /* <--  RecordID of initiator returned here. Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  116.     Boolean                         hasIntermediary;            /* <--  will be set if credentials has an intermediary */
  117.     Boolean                         filler1;
  118.     RecordIDPtr                     intermediary;                /* <--  RecordID of intermediary returned here. (If intermediary is found in credentials Must give appropriate Buffer to hold RecordID (Only for passive or accept mode) */
  119. };
  120. typedef struct TRSecureParams            TRSecureParams;
  121. typedef struct SDSPParamBlock             SDSPParamBlock;
  122.  
  123. typedef SDSPParamBlock *                SDSPPBPtr;
  124. typedef CALLBACK_API( void , SDSPIOCompletionProcPtr )(SDSPPBPtr paramBlock);
  125. /*
  126.     WARNING: SDSPIOCompletionProcPtr uses register based parameters under classic 68k
  127.              and cannot be written in a high-level language without 
  128.              the help of mixed mode or assembly glue.
  129. */
  130. typedef REGISTER_UPP_TYPE(SDSPIOCompletionProcPtr)                 SDSPIOCompletionUPP;
  131.  
  132. struct SDSPParamBlock {
  133.     QElem *                            qLink;
  134.     short                             qType;
  135.     short                             ioTrap;
  136.     Ptr                             ioCmdAddr;
  137.     SDSPIOCompletionUPP             ioCompletion;
  138.     OSErr                             ioResult;
  139.     StringPtr                         ioNamePtr;
  140.     short                             ioVRefNum;
  141.     short                             ioCRefNum;                    /* adsp driver refNum */
  142.     short                             csCode;                        /* adsp driver control code */
  143.     long                             qStatus;                    /* adsp internal use */
  144.     short                             ccbRefNum;
  145.     union {
  146.         TRinitParams                     initParams;                /* dspInit, dspCLInit */
  147.         TRopenParams                     openParams;                /* dspOpen, dspCLListen, dspCLDeny */
  148.         TRcloseParams                     closeParams;            /*dspClose, dspRemove*/
  149.         TRioParams                         ioParams;                /*dspRead, dspWrite*/
  150.         TRattnParams                     attnParams;                /*dspAttention*/
  151.         TRstatusParams                     statusParams;            /*dspStatus*/
  152.         TRoptionParams                     optionParams;            /*dspOptions*/
  153.         TRnewcidParams                     newCIDParams;            /*dspNewCID*/
  154.         TRSecureParams                     secureParams;            /* dspOpenSecure */
  155.     }                                 u;
  156. };
  157.  
  158. enum { uppSDSPIOCompletionProcInfo = 0x00009802 };                 /* register no_return_value Func(4_bytes:A0) */
  159. #define NewSDSPIOCompletionProc(userRoutine)                     (SDSPIOCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSDSPIOCompletionProcInfo, GetCurrentArchitecture())
  160. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  161.     #pragma parameter CallSDSPIOCompletionProc(__A1, __A0)
  162.     void CallSDSPIOCompletionProc(SDSPIOCompletionUPP routine, SDSPPBPtr paramBlock) = 0x4E91;
  163. #else
  164.     #define CallSDSPIOCompletionProc(userRoutine, paramBlock)     CALL_ONE_PARAMETER_UPP((userRoutine), uppSDSPIOCompletionProcInfo, (paramBlock))
  165. #endif
  166.  
  167.  
  168. #if PRAGMA_STRUCT_ALIGN
  169.     #pragma options align=reset
  170. #elif PRAGMA_STRUCT_PACKPUSH
  171.     #pragma pack(pop)
  172. #elif PRAGMA_STRUCT_PACK
  173.     #pragma pack()
  174. #endif
  175.  
  176. #ifdef PRAGMA_IMPORT_OFF
  177. #pragma import off
  178. #elif PRAGMA_IMPORT
  179. #pragma import reset
  180. #endif
  181.  
  182. #ifdef __cplusplus
  183. }
  184. #endif
  185.  
  186. #endif /* __ADSPSECURE__ */
  187.  
  188.